﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.ETL.Domain.IntegrityCheck
{
    public static class ICFactory
    {
        public static IIntegrityCheck Create(Guid id)
        {
            if(id == DataRowCountIC.ID)
            {
                return new DataRowCountIC();
            }
            else if(id == DataNotNullIC.ID)
            {
                return new DataNotNullIC();
            }
            return null;
        }

        /// <summary>
        /// 枚举所有可用的数据有效性验证插件
        /// </summary>
        /// <returns></returns>
        public static List<ICInfo> EnumIC()
        {
            List<ICInfo> infos = new List<ICInfo>();

            infos.Add(new ICInfo()
            {
                Id = DataRowCountIC.ID,
                Name = DataRowCountIC.NAME,
                Description = DataRowCountIC.DESCRIPTION,
                ParameterList = new DataRowCountIC().EnumParameters()
            });
            infos.Add(new ICInfo()
            {
                Id = DataNotNullIC.ID,
                Name = DataNotNullIC.NAME,
                Description = DataNotNullIC.DESCRIPTION,
                ParameterList = new DataNotNullIC().EnumParameters()
            });

            return infos;
        }

        public class ICInfo
        {
            public Guid Id { get; set; }
            public string Name { get; set; }
            public string Description { get; set; }

            public List<IntegrityCheck.Parameter> ParameterList { get; set; }
        }
    }
}
